<?php
   header('content-type:application:json;charset=utf8');
    header('Access-Control-Allow-Origin:*');
    header('Access-Control-Allow-Methods:POST,GET');
    header('Access-Control-Allow-Headers:x-requested-with,content-type');

    $db = mysql_connect("bdm291063485.my3w.com","bdm291063485","caojin621");

    mysql_query("SET NAMES 'UTF8'");//设置编码

    if($db){
        mysql_select_db("bdm291063485_db",$db);
        $sql = "select * from work";
        $result = mysql_query($sql);

        $results = array();

        while($row = mysql_fetch_assoc($result)){
            $results[] = $row;
        }

        echo json_encode($results);
        mysql_close($db);
    }else{
        echo "error";
    }
?>